Page({
  data: {
    box_id:0,
    name:'',
    mobile:'',
    address:''
  },
  onLoad(e) {
   my.getSystemInfo({
      success: (res) => {
        console.log(res)
        this.setData({
          windowHeight: res.windowHeight
        })
      },
    });
    this.setData({
      box_id:e.e.box_id
    })
  },
  onFormChange(e){
    this.setData({
      formData:e.detail.value
    })
  },
  async handleSubmit(){
    const {cloud}=getApp();
    const res=cloud.applicatin.httpRequest({
      path:'/index.php/index/tb/address',
      method:'POST',
      params:{
        shop_id:getApp().globalData.shop_id,
        box_id:this.data.box_id,
        name:this.data.name,
        mobile:this.data.formData.mobile,
        address:this.data.formData.address
      }
    })
    my.alert({
      title:'提交成功，请等待发货！'
    })
  }
});
